This page last changed on Nov 06, 2005 by aperepel.

The JndiContainerContext can be used to expose objects stored in Jndi as Mule components. To configure a Jndi container you need to add a <container-context> element that uses the org.mule.impl.container.JndiContainerContext and set the Jndi environment properties.

<container-context className="org.mule.impl.container.JndiContainerContext">
    <properties>
        <map name="environment">
            <property name="java.naming.factory.initial" value="org.foo.jndi.InitialContextFactory"/>
        </map>
    </properties>
</container-context>

You can also omit specifying environment properties altogether as follows:

<container-context className="org.mule.impl.container.JndiContainerContext"/>

In this case a standard JavaSE JNDI lookup mechanism with fallback will be utilised.

Components can reference an object stored in Jndi by setting the implementation attribute of a <mule-descriptor> to the name of the stored object.

<mule-descriptor name="MyComponent" implementation="myJndiObject">
    ....
</mule-descriptor>

It's also possible to reference any property from JNDI, e.g. inject a DataSource into JdbcConnector:

<container-context className="org.mule.impl.container.JndiContainerContext"/>

...

<connector name="jdbcConnector" className="org.mule.providers.jdbc.JdbcConnector">
        <properties>
            <property name="pollingFrequency" value="1000"/>
            <container-property name="dataSource"
                                reference="jdbc/OrderDS-XA"
                                required="true"/>
            ...
</connector>
Document generated by Confluence on Nov 27, 2006 10:27